<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>古画商城-后台管理</title>
</head>
<body>
<jsp:include page="header.jsp"/>

<c:if test="${empty user}">
    <jsp:forward page="login.jsp"></jsp:forward>
</c:if>
<c:if test="${!empty user}">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-2">
                    </div>
                    <div class="col-md-8">
                        <table class="table">
                            <thead>
                            <tr>
                                <th>
                                    序号
                                </th>
                                <th>
                                    分类
                                </th>
                                <th>
                                    古画名
                                </th>
                                <th>
                                    画家
                                </th>
                                <th>
                                    出版社
                                </th>
                                <th>
                                    价格
                                </th>
                                <th>
                                    作品
                                </th>
                                <th>
                                    购买
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:if test="${!empty ancientPaintings}">
                                <c:forEach items="${ancientPaintings}" var="ancientPainting" varStatus="vs">
                                    <c:if test="${vs.count%2==0}">
                                        <tr class="table-active">
                                            <td>${vs.count}</td>
                                            <td>${ancientPainting.catalogName}</td>
                                            <td>${ancientPainting.name}</td>
                                            <td>${ancientPainting.author}</td>
                                            <td>${ancientPainting.press}</td>
                                            <td>${ancientPainting.price}</td>
                                            <td>
                                                <c:if test="${ancientPainting.path.length() > 0}">
                                                    <img src="${ancientPainting.path}" width='80' height='80' alt="加载失败"/>
                                                </c:if>
                                                <c:if test="${ancientPainting.path.length() == null || ancientPainting.path.length() == 0}">
                                                    <img src="images/img_blank.png" width='80' height='80'/>
                                                </c:if>
                                            </td>
                                            <td><a href="purchaseAncientPainting.action?id=${ancientPainting.id}"/>购买此画</td>
                                        </tr>
                                    </c:if>
                                    <c:if test="${vs.count%2!=0}">
                                        <tr>
                                            <td>${vs.count}</td>
                                            <td>${ancientPainting.catalogName}</td>
                                            <td>${ancientPainting.name}</td>
                                            <td>${ancientPainting.author}</td>
                                            <td>${ancientPainting.press}</td>
                                            <td>${ancientPainting.price}</td>
                                            <td>
                                                <c:if test="${ancientPainting.path.length() > 0}">
                                                    <img src="${ancientPainting.path}" width='80' height='80' alt="加载失败"/>
                                                </c:if>
                                                <c:if test="${ancientPainting.path.length() == null || ancientPainting.path.length() == 0}">
                                                    <img src="images/img_blank.png" width='80' height='80'/>
                                                </c:if>
                                            </td>
                                            <td><a href="purchaseAncientPainting.action?id=${ancientPainting.id}"/>购买此画</td>
                                        </tr>
                                    </c:if>
                                </c:forEach>
                            </c:if>
                            <c:if test="${empty ancientPaintings}">
                                <tr>
                                    <td colspan="6">无</td>
                                </tr>
                            </c:if>
                            </tbody>

                        </table>
                        <c:if test="${!empty number}">
                            <a href='showCart.action'>您已购买 ${number} 幅画，查看购物车</a>
                        </c:if>
                    </div>
                    <div class="col-md-2">
                    </div>
                </div>
            </div>
        </div>
    </div>

</c:if>

</body>
</html>